package variabilitysmelldetection;

import java.io.File;
import java.util.List;

import variabilitysmelldetection.analyses.GodClass;
import variabilitysmelldetection.analyses.GodMethod;
import variabilitysmelldetection.analyses.ShotgunSurgery;
import variabilitysmelldetection.measurement.Measurement;
import variabilitysmelldetection.measurement.models.ComponentItem;
import variabilitysmelldetection.measurement.models.MethodItem;
import variabilitysmelldetection.measurement.models.Project;

public class Application {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		String[] projectsNames = {
				/*"AHEAD-bali",
				"AHEAD-guidsl",
				"AHEAD-java",
				"DesktopSearcher",
				"Devolution",
				"EPL",
				"GPL",*/
				"Tankwar",
				/*"WebStoreSPL-001",
				"WebStoreSPL-002",
				"WebStoreSPL-003",
				"WebStoreSPL-004",
				"WebStoreSPL-005",
				"WebStoreSPL-006",*/
		};
		
		StringBuilder projectsData = new StringBuilder();
		
		for (String name : projectsNames) {
			File file = new File("features"+File.separator+name);
			Project project = new Project(name, file.getAbsolutePath());
			
			Measurement measurement = new Measurement(project);
			measurement.execute();
			
			WriteCSV.writeMethods(project);
			WriteCSV.writeClasses(project);
			WriteCSV.writeProject(project);
			
			
			projectsData.append(project.toCSV());
			projectsData.append("\n");
			
			GodMethod godMethod = new GodMethod();
			List<MethodItem> godMethods = godMethod.getGodMethods(project);
			WriteCSV.writeGodMethods(project, godMethods);
			
			GodClass godClass = new GodClass();
			List<ComponentItem> godClasses = godClass.getGodClasses(project);
			WriteCSV.writeGodClasses(project, godClasses);
			
			ShotgunSurgery shotgunSurgery = new ShotgunSurgery();
			List<ComponentItem> shotgunSurgeryClasses = shotgunSurgery.getShotgunSurgeryClasses(project);
			WriteCSV.writeShotgunSurgery(project, shotgunSurgeryClasses);
		}
		
		//System.out.println(projectsData.toString());
	}
}
